package com.atguigu.realtime.sugar.mapper;

import com.atguigu.realtime.sugar.bean.Kw;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author lzc
 * @Date 2022/3/29 14:00
 */
public interface KwMapper {
    
    @Select("SELECT\n" +
        "    keyword,\n" +
        "    sum(ct * multiIf(source = 'search', 2, source = 'click', 4, source = 'cart', 6, 8)) AS score\n" +
        "FROM keyword_stats_2021\n" +
        "WHERE toYYYYMMDD(stt) = #{date}\n" +
        "GROUP BY keyword\n")
    List<Kw> kw(int date);
}
